import request from '../utils/request';
// 角色列表接口
export const getRoleListApi = () => request({
  url: 'roles',
});
// 删除角色权限
export const delRoleApi = (id, rid) => request({
  url: `roles/${id}/rights/${rid}`,
  method: 'delete',
});
// 新增角色
export const addRoleApi = (data) => request({
  url: 'roles',
  method: 'post',
  data,
});

// 编辑角色
export const editRoleApi = (data, id) => request({
  url: `roles/${id}`,
  method: 'put',
  data,
});
// 删除角色
export const delRolesApi = (id) => request({
  url: `roles/${id}`,
  method: 'delete',
});
// 全部权限列表
export const getRightApi = () => request({
  url: 'rights/tree',
});
// 分配权限
export const setRightApi = (data, id) => request({
  url: `roles/${id}/rights`,
  method: 'post',
  data,
});
